import React from "react";

import {Route,Redirect,Switch} from 'react-router-dom';
import './app.css'
import Home from "../pages/home";
import Goods from "../pages/goods";
import User from "../pages/user";
import Login from "../pages/login";
import Reg from "../pages/reg";
import NoPage from "../pages/no-page";
import Header from "../components/header";
import Footer from "../components/footer";
import Auth from "../guard/auth";

export default class App extends React.Component {

  state = {
  };

  render() {
    return (
      <div>

        <h3>路由</h3>

        <Header {...this.props} />

        <div className="wrap">
          <Switch>
            {/*<Route exact path="/" component={Home} />*/}
            <Auth path="/home" component={Home} />
            {/*<Route path="/GOods" component={Goods} />*/}
            <Auth path="/GOods" component={Goods} />

            {/*<Route path="/user" component={User} />*/}
            <Route path="/user" render={()=>{
              console.log('交待一些业务')
              return <User/>
            }} />
            <Route path="/login" component={Login} />
            <Route path="/reg" component={Reg} />
            <Redirect from="/" to="/home" />
            <Route component={NoPage} />
          </Switch>

        </div>

        <Footer/>

      </div>
    )
  }
}